/*
 * @Description:
 * @Author: 阳婷
 * @Date: 2019-07-30 10:21:49
 * @LastEditTime: 2023-02-24 10:45:33
 * @LastEditors: 阳婷
 */

import { createRouter, createWebHashHistory } from "vue-router";

import layout from "./../views/layout/Layout.vue";
import login from "./../views/login";

const routes = [
  {
    path: "/login",
    name: "login",
    component: login,
  },
  { path: "/", redirect: "/login" },
  {
    path: "/",
    component: layout,
    children: [
      {
        path: "/api/main",
        name: "main",
        meta: { title: "首页" },
        component: () => import("./../views/main/index.vue"),
      },
      {
        path: "/api/orders",
        name: "orders",
        meta: { title: "订单管理" },
        component: () => import("./../views/orderList/index.vue"),
      },
      {
        path: "/api/categories",
        name: "categories",
        meta: { title: "分类管理" },
        component: () => import("./../views/productType/index.vue"),
      },
      {
        path: "/api/products",
        name: "products",
        meta: { title: "商品管理" },
        component: () => import("./../views/productList/index.vue"),
      },
    {
        path: "/api/users",
        name: "users",
        meta: { title: "用户管理" },
        component: () => import("./../views/members/index.vue"),
      },{
        path: "/api/shelfs",
        name: "shelfs",
        meta: { title: "货柜管理" },
        component: () => import("./../views/shelfs/index.vue"),
      },{
        path: "/api/role",
        name: "role",
        meta: { title: "角色管理" },
        component: () => import("./../views/role/index.vue"),
      },{
        path: "/api/report",
        name: "report",
        meta: { title: "报表统计" },
        component: () => import("./../views/report/index.vue"),
      }
    ],
  },
  {
    path: "/404",
    name: "404",
    component: () => import("./../views/404.vue"),
  },
];
const router = createRouter({
  history: createWebHashHistory(),
  routes: routes,
});

export default router;
